home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / impdes / dessin.bas next >
BASIC Source File  |  1995-09-07  |  22KB  |  376 lines

  1. '                                                                                                                                                                                                               '
  2. '                                                                                                                                                                                                                '
  3. 'DΘfinition des types                                                                                                                                                                                             '
  4. '                                                                                                                                                                                                                  '
  5. '                                                                                                                                                                                                                   '
  6.     Option Explicit
  7.     DefInt A-Z
  8.  
  9.     Type BITMAPINFOHEADER_Type
  10.     biSize As Long
  11.     biWidth As Long
  12.     biHeight As Long
  13.     biPlanes As Integer
  14.     biBitCount As Integer
  15.     biCompression As Long
  16.     biSizeImage As Long
  17.     biXPelsPerMeter As Long
  18.     biYPelsPerMeter As Long
  19.     biClrUsed As Long
  20.     biClrImportant As Long
  21.     End Type
  22.      
  23.     Type BITMAPINFO_Type
  24.     BitmapInfoHeader As BITMAPINFOHEADER_Type
  25.     bmiColors As String * 1024
  26.     End Type
  27.      
  28.     Type RectType
  29.     Left As Integer
  30.     Top As Integer
  31.     Right As Integer
  32.     Bottom As Integer
  33.     End Type
  34.     Type PointType
  35.     X As Integer
  36.     Y As Integer
  37.     End Type
  38. '                                                                                                                                                                                                               '
  39. '                                                                                                                                                                                                                '
  40. 'API                                                                                                                                                                                            '
  41. '                                                                                                                                                                                                                  '
  42. '                                                                                                                                                                                                                   '
  43.     Declare Function CreateCompatibleDC Lib "gdi" (ByVal hDC)
  44.     Declare Function GetWindowDC Lib "user" (ByVal hWnd)
  45.     Declare Function GetDC Lib "user" (ByVal hWnd)
  46.     Declare Function ReleaseDC Lib "user" (ByVal hWnd, ByVal hDC)
  47.     Declare Function DeleteDC Lib "gdi" (ByVal hDC)
  48.     ' Graphics related API
  49.     Declare Function BitBlt Lib "gdi" (ByVal hDC, ByVal X, ByVal Y, ByVal w, ByVal h, ByVal hDC, ByVal X, ByVal Y, ByVal o As Long)
  50.     Declare Function GetDIBits Lib "gdi" (ByVal hDC, ByVal hBitmap, ByVal nStartScan, ByVal nNumScans, ByVal LpBits As Long, BitmapInfo As BITMAPINFO_Type, ByVal wUsage)
  51.     Declare Function StretchDIBits Lib "gdi" (ByVal hDC, ByVal DestX, ByVal DestY, ByVal wDestWidth, ByVal wDestHeight, ByVal SrcX, ByVal SrcY, ByVal wSrcWidth, ByVal wSrcHeight, ByVal LpBits&, BitsInfo As BITMAPINFO_Type, ByVal wUsage, ByVal dwRop&)
  52.     ' General attribute related API
  53.     Declare Function GetDeviceCaps Lib "gdi" (ByVal hDC, ByVal nIndex)
  54.     Declare Function GetWindowRect Lib "user" (ByVal hWnd, lpRect As RectType)
  55.     Declare Function GetClientRect Lib "user" (ByVal hWnd, lpRect As RectType)
  56.     ' Memory allocation related API
  57.     Declare Function GlobalAlloc Lib "kernel" (ByVal wFlags, ByVal lMem&)
  58.     Declare Function GlobalLock Lib "kernel" (ByVal HMem) As Long
  59.     Declare Function GlobalUnlock Lib "kernel" (ByVal HMem)
  60.     Declare Function GlobalFree Lib "kernel" (ByVal HMem)
  61.     ' Graphics object related API
  62.     Declare Function CreateCompatibleBitmap Lib "gdi" (ByVal hDC, ByVal nWidth, ByVal nHeight)
  63.     Declare Function DeleteObject Lib "gdi" (ByVal hObject)
  64.     Declare Function SelectObject Lib "gdi" (ByVal hDC, ByVal hObject)
  65.     Declare Function ClientToScreen Lib "user" (ByVal hWnd, P As PointType)
  66.     Declare Function LPToDP Lib "gdi" (ByVal hDC, P As PointType, ByVal nCount)
  67. '                                                                                                                                                                                                               '
  68. '                                                                                                                                                                                                                '
  69. 'DΘfinition des Global Constantes                                                                                                                                                                                             '
  70. '                                                                                                                                                                                                                  '
  71. '                                                                                                                                                                                                                   '
  72.     Global Const HORZRES = 8
  73.     Global Const VERTRES = 10
  74.     Global Const SRCCOPY = &HCC0020
  75.     Global Const NEWFRAME = 1
  76.     Global Const BITSPIXEL = 12
  77.     Global Const PLANES = 14
  78.     Global Const BI_RGB = 0
  79.     Global Const BI_RLE8 = 1
  80.     Global Const BI_RLE4 = 2
  81.     Global Const DIB_PAL_COLORS = 1
  82.     Global Const DIB_RGB_COLORS = 0
  83.     Global Const GMEM_MOVEABLE = 2
  84.  
  85. Sub ImprimeGraphique (F As Form)
  86.     Dim R As Integer
  87. '                                                                                                                                                                                                                                                                                                                                                                                               '
  88. '                                                                                                                                                                                                                                                                                                                                                                                                '
  89. 'Cette procΘdure permet l'impression d'une fenΩtre                                                                                                                                                                                                                                                                                                                                                '
  90. '                                                                                                                                                                                                                                                                                                                                                                                                  '
  91. '                                                                                                                                                                                                                                                                                                                                                                                                   '
  92.     Printer.ScaleMode = 3
  93.     Screen.MousePointer = 11
  94.     Printer.Print ""
  95.     'Appel de la fonction